package org.example.fault.retry;

import org.example.spi.SpiLoader;

/**
 * @Title: RetryStrategyFactory
 * @Author: kunliangzhao
 * @Package org.example.fault.retry
 * @Date: 2025/6/23 15:38
 * @Description: 工厂
 */

public class RetryStrategyFactory {

    static {
        SpiLoader.load(RetryStrategy.class);
    }

    /**
     * 默认重试器
     */
    private static final RetryStrategy DEFAULT_RETRY_STRATEGY = new NoRetryStrategy();

    /**
     * 获取实例
     *
     * @param key
     * @return
     */
    public static RetryStrategy getInstance(String key) {
        return SpiLoader.getInstance(RetryStrategy.class, key);
    }

}
